package com.forum.pojo;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;


/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="t_user"
    ,catalog="forum"
, uniqueConstraints = {@UniqueConstraint(columnNames="userName"), @UniqueConstraint(columnNames="headImage")}
)

public class User  implements java.io.Serializable {


    // Fields    

     private Integer userId;
     private String userName;
     private String userpass;
     private String useremail;
     private String birthday;
     private String sex;
     private String headImage;
     private String statement;
     private String regdate;
     private String userstate;
     private Integer point;
     private String usertype;
     private Set<Reply> replies = new HashSet<Reply>(0);
     private Set<Subitem> subitems = new HashSet<Subitem>(0);
     private Set<Post> posts = new HashSet<Post>(0);


    // Constructors

    /** default constructor */
    public User() {
    }

	/** minimal constructor */
    public User(String userName, String userpass, String useremail, String sex, String regdate) {
        this.userName = userName;
        this.userpass = userpass;
        this.useremail = useremail;
        this.sex = sex;
        this.regdate = regdate;
    }
    
    /** full constructor */
    public User(String userName, String userpass, String useremail, String birthday, String sex, String headImage, String statement, String regdate, String userstate, Integer point, String usertype, Set<Reply> replies, Set<Subitem> subitems, Set<Post> posts) {
        this.userName = userName;
        this.userpass = userpass;
        this.useremail = useremail;
        this.birthday = birthday;
        this.sex = sex;
        this.headImage = headImage;
        this.statement = statement;
        this.regdate = regdate;
        this.userstate = userstate;
        this.point = point;
        this.usertype = usertype;
        this.replies = replies;
        this.subitems = subitems;
        this.posts = posts;
    }

   
    // Property accessors
    @GenericGenerator(name="generator", strategy="increment")@Id @GeneratedValue(generator="generator")
    
    @Column(name="userId", unique=true, nullable=false)

    public Integer getUserId() {
        return this.userId;
    }
    
    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    
    @Column(name="userName", unique=true, nullable=false, length=31)

    public String getUserName() {
        return this.userName;
    }
    
    public void setUserName(String userName) {
        this.userName = userName;
    }
    
    @Column(name="userpass", nullable=false, length=31)

    public String getUserpass() {
        return this.userpass;
    }
    
    public void setUserpass(String userpass) {
        this.userpass = userpass;
    }
    
    @Column(name="useremail", nullable=false, length=31)

    public String getUseremail() {
        return this.useremail;
    }
    
    public void setUseremail(String useremail) {
        this.useremail = useremail;
    }
    
    @Column(name="birthday", length=31)

    public String getBirthday() {
        return this.birthday;
    }
    
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
    
    @Column(name="sex", nullable=false, length=2)

    public String getSex() {
        return this.sex;
    }
    
    public void setSex(String sex) {
        this.sex = sex;
    }
    
    @Column(name="headImage", unique=true, length=11)

    public String getHeadImage() {
        return this.headImage;
    }
    
    public void setHeadImage(String headImage) {
        this.headImage = headImage;
    }
    
    @Column(name="statement")

    public String getStatement() {
        return this.statement;
    }
    
    public void setStatement(String statement) {
        this.statement = statement;
    }
    
    @Column(name="regdate", nullable=false, length=31)

    public String getRegdate() {
        return this.regdate;
    }
    
    public void setRegdate(String regdate) {
        this.regdate = regdate;
    }
    
    @Column(name="userstate", length=3)

    public String getUserstate() {
        return this.userstate;
    }
    
    public void setUserstate(String userstate) {
        this.userstate = userstate;
    }
    
    @Column(name="point")

    public Integer getPoint() {
        return this.point;
    }
    
    public void setPoint(Integer point) {
        this.point = point;
    }
    
    @Column(name="usertype", length=5)

    public String getUsertype() {
        return this.usertype;
    }
    
    public void setUsertype(String usertype) {
        this.usertype = usertype;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Reply> getReplies() {
        return this.replies;
    }
    
    public void setReplies(Set<Reply> replies) {
        this.replies = replies;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Subitem> getSubitems() {
        return this.subitems;
    }
    
    public void setSubitems(Set<Subitem> subitems) {
        this.subitems = subitems;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Post> getPosts() {
        return this.posts;
    }
    
    public void setPosts(Set<Post> posts) {
        this.posts = posts;
    }
   








}